import json

from flask import Blueprint, render_template
from App.ext import redis

collection = Blueprint("collection", __name__)


@collection.route("/index")
def index():
    macs = redis.get("macs")
    current_mac = redis.get("current_mac")
    mac_list = json.loads(macs)
    distance = redis.get("new_line")
    collection_method = redis.get("collection_method")

    is_collection = redis.get("is_collection") == "1"
    return render_template("index.html", macs=mac_list, distance=distance,is_collection=is_collection,current_mac=current_mac, collection_method=collection_method)
